/**
 * Copyright &copy; 2012-2016 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.sys.web;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.mvc.support.RedirectAttributes;

import com.thinkgem.jeesite.common.web.BaseController;
import com.thinkgem.jeesite.modules.sys.entity.MailConf;
import com.thinkgem.jeesite.modules.sys.service.MailConfService;

/**
 * 邮箱配置Controller
 * @author 范青龙
 * @version 2017-11-02
 */
@Controller
@RequestMapping(value = "${adminPath}/sys/mailConf")
public class MailConfigController extends BaseController{
	@Autowired
	private MailConfService mailConfService;
	
	@RequiresPermissions("sys:mailConf:view")
	@RequestMapping(value = {"form",""})
	public String form(Model model) {
		return "modules/sys/mailConfForm";
	}
	
	@RequiresPermissions("sys:mailConf:edit")
	@RequestMapping(value = "save")//@Valid 
	public String save(MailConf mailConf, Model model, RedirectAttributes redirectAttributes) {
		mailConfService.save(mailConf);
		addMessage(redirectAttributes, "修改成功");
		return "redirect:" + adminPath + "/sys/mailConf";
	}
}
